import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../globel_widget.dart';
import 'detail_item_logic.dart';

class DetailItemComponent extends StatelessWidget {
  final logic = Get.put(DetailItemLogic());

  String leftLabel;
  String leftText;
  String rightLabel;
  String rightText;

  DetailItemComponent(
      {super.key,
      this.leftLabel = "",
      this.leftText = "",
      this.rightLabel = "",
      this.rightText = ""});

  @override
  Widget build(BuildContext context) {
    return Container(
        child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        spaceWidth(),
        Expanded(
          child: buildLeftComponent(),
          flex: 10,
        ),
        spaceWidth(),
        Expanded(
          child: buildRightComponent(),
          flex: 7,
        ),
        spaceWidth(),
      ],
    ));
  }

  buildLeftComponent() {
    style:
    return Row(
      children: [
        Expanded(
          flex: 3,
          child: Container(
              padding: const EdgeInsets.fromLTRB(1, 5, 1, 5),
              child: Text(leftLabel, style: const TextStyle(fontSize: 16))),
        ),
        Expanded(
          flex: 5,
          child: Container(
            decoration: BoxDecoration(
                border: Border.all(color: Colors.black, width: 1)),
            child: Container(
                color: const Color(0xFFBDBDBD),
                padding: const EdgeInsets.fromLTRB(1, 10, 1, 10),
                child: Center(
                  child: Text(leftText, style: const TextStyle(fontSize: 14)),
                )),
          ),
        )
      ],
    );
  }

  buildRightComponent() {
    return Row(
      children: [
        Expanded(
          flex: 2,
          child: Text(rightLabel, style: const TextStyle(fontSize: 16))),
        Expanded(
          flex: 2,
          child: Container(
            decoration: BoxDecoration(
                border: Border.all(color: Colors.black, width: 1)),
            child: Container(
                color: const Color(0xFFBDBDBD),
                padding: const EdgeInsets.fromLTRB(1, 10, 1, 10),
                child: Center(
                  child: Text(rightText, style: const TextStyle(fontSize: 14)),
                )),
          ),
        )
      ],
    );
  }
}
